require 'sketchup.rb'
# require File.join(__FILE__, '../AF.rb')
require 'json'

module AMTF
  class A选择对象观察者 < Sketchup::SelectionObserver
    include AMTF_mixin
    def initialize(窗口)
      @窗口对象=窗口
      # @A画边界框m=Sketchup.active_model.select_tool A画边界框.new

    end
    def onSelectionBulkChange(selection)
      puts "onSelectionBulkChange: #{selection}"
      c=selection[0]
      边界=获取边界大小(c)
      # AMTF::AMTF窗口.new
      # AMTF窗口.new().显示边界框尺寸(边界)
      # AMTF窗口.显示边界框尺寸(边界)
      边界h=Hash[]
      边界h["x"]=边界[0].to_mm.round(2)
      边界h["y"]=边界[1].to_mm.round(2)
      边界h["z"]=边界[2].to_mm.round(2)
      边界js=边界h.to_json
      puts 边界js
      @窗口对象.显示边界框尺寸(边界js)

      # view = Sketchup.active_model.active_view
      # box=边界[3]
      # Sketchup.active_model.select_tool A画边界框.new(view,box)
      # A画边界框m.draw(view,box)
    end


  end #class
end # module amtf_su
